﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;

namespace YmSoft.WPF.Core
{
    public class BaseNotifyPropertyChanged : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;
        protected void NotifyPropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }

        static bool? isInDesignMode;
        protected bool IsInDesignMode
        {
            get
            {
                if (isInDesignMode != null)
                {
                    return isInDesignMode.Value;
                }
                if (System.Reflection.Assembly.GetExecutingAssembly().Location.Contains("VisualStudio"))
                {
                    isInDesignMode = true;
                }
                isInDesignMode = false;
                return isInDesignMode.Value;
            }
        }
    }
}
